package com.cn.web.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBUtils {
	private final static String DERIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
	private final static String URL = "jdbc:sqlserver://localhost:1433;databaseName=yuhaitao";
	private final static String USERNAME = "sa";
	private final static String PWD = "123456";
	
	public static Connection getConnection(){
		Connection conn = null;
		try {
			Class.forName(DERIVER);
			conn = DriverManager.getConnection(URL, USERNAME, PWD);}
		catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		 catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}		
		return conn;		
	}	
	public static void main(String[] args) {
		Connection conn = getConnection();
		
	}
}
